citations = [3, 0, 6, 1, 5]
// 0  1  3  5  6
citations = [1, 3, 1]
var hIndex = function (citations) {
    citations.sort()
    let len = citations.length
    let k = len
    while (k > 0) {
        let count = 0
        for (let i = 0; i < len; i++) {
            if (citations[i] >= k) {
                count++
            }
            if (count === k) {
                return k
            }
        }
        k--
    }
    return 0
};
console.log(hIndex(citations));
